﻿@{
    ViewBag.Title = "卡券类别管理";
    ViewBag.PathToBtn = "/CardCategory/List";
    ViewBag.TextBtn = "刷新";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                卡券类别列表
            </div>
            <div class="panel-body">
                <div class="dataTable_wrapper">
                    <table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example">
                        <thead>
                            <tr>
                                <th>类别名称</th>
                                <th>类别编码</th>
                                <th>描述</th>
                                <th>警示信息</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody></tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
@section javascript{
    <script src="/Content/admin/dist/js/pagingHelper.js"> </script>
    <script type="text/javascript">
        var dataParams = {};
        var serverProcessPath = "/CardCategory/Listing";
        var showColumns = [
            { data: "CategoryName" },
            { data: "CategoryCode" },
            { data: "Description" },
            { data: "WarningInfo" },
            { data: "Action" }
        ];
        pagingHelper.Paging(serverProcessPath, dataParams, showColumns);

        function updateData(id) {
            document.location.href = '/CardCategory/Update/' + id;
        }

        function deleteData(id) {
            alertify.okBtn("确定").cancelBtn("取消").confirm("确定要删除该数据吗？", function () {
                $.ajax({
                    type: 'post',
                    async: false,
                    url: '/CardCategory/Delete',
                    data: { doIds: id },
                    success: function (result) {
                        if (result) {
                            alertify.success("数据删除成功");
                            pagingHelper.reload();
                        } else {
                            alertify.error("数据删除失败");
                        }
                    }
                });
            });
        }
    </script>
}